<?=$this->renderPartial("tabNavigation", array('s_tabSelected'=>'index'))?>

<div class="clear"></div>

<div class="box">
    <div class="box_content" id="div_contentBox">
        <div class="button_navigation">
            <button 
                id      = "btn_refresh"
                class   = "button_round"
                onclick = "load_page('<?=Yii::app()->createUrl("account/index")?>');"
            >
                <i class="fa fa-refresh"></i>
            </button>

            <button id="btn_delete" class="button_round">
                <i class="fa fa-trash-o"></i>
            </button>

            <button id="btn_excelExport" class="button_round">
                <i class="fa fa-download"></i>
            </button>
        </div><!--End button_navigation-->

        <table class="tb_general" id="tb_category">
            <tr>
                <th class="text_center" style="width:2%;">
                    <span class="fa fa-trash-o fa-2x"></span>
                </th>

                <th style="width: 2%;">STT</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('identity')?>', this);"     style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Tài Khoản</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('authority')?>', this);"    style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Quyền</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('name')?>', this);"         style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Họ và Tên</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('email')?>', this);"        style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>E-mail</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('is_female')?>', this);"    style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Giới Tính</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('phone')?>', this);"        style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Số Điện Thoại</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('organization')?>', this);" style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Công Ty</th>
                <th onclick="sortData('<?=Account::model()->getAttributeLabel('insert')?>', this);"       style="cursor:pointer;"><i class="fa fa-sort">&nbsp;</i>Ngày Nhập</th>
            </tr>

            <tr id="tr_search">
                <td>
                    <input
                        type    = "checkbox"
                        class   = "check_box"
                        onclick = "setGeneralStatusOfCheckboxes(this, 'chk_delete')"
                    />
                </td>

                <td><i class="fa fa-search fa-2x"></i></td>

                <td colspan="8">
                    <form
                        id     = "frm_search"
                        name   = "frm_search"
                        method = "get"
                        action = "<?=Yii::app()->createUrl("account/index");?>"
                    >

                    <input
                        type  = "hidden"
                        id    = "hid_columnName"
                        name  = "hid_columnName"
                        value = "<?=$s_columnLabel;?>"
                    />

                    <input
                        type  = "hidden"
                        id    = "hid_columnPosition"
                        name  = "hid_columnPosition"
                        value = "<?=$i_columnPosition;?>"
                    />

                    <input
                        type  = "hidden"
                        id    = "hid_sortMethod"
                        name  = "hid_sortMethod"
                        value = "<?=$s_sortMethod;?>"
                    />

                    <input
                        type     = "text"
                        id       = "txt_filter"
                        name     = "txt_filter"
                        class    = "text_box"
                        value    = "<?=$s_filter;?>"
                        tabindex = "1"
                    />
                    </form>
                </td>
            </tr>

            <tbody id="tbody_category">
                <?php
                $i_stt = 0;

                foreach ( $arr_data as $key => $o_account) {
                    if ( !($o_account instanceof Account) ) {
                        continue;
                    }

                    $date_insert = new DateTime($o_account->insert);
                    $i_stt +=1;
                ?>
                <tr id="tr_<?=$o_account->identification;?>">
                    <td>
                        <input 
                            name  = "chk_delete"
                            type  = "checkbox"
                            class = "check_box"
                            value = "<?=$o_account->identification;?>"
                        />
                    </td>

                    <td><?=$i_stt?></td>

                    <td>
                        <a
                           href    = "javaScript:void(0);"
                           onclick = "call_edit_page(<?=$o_account->identification?>)"
                        >
                            <i class="fa fa-edit fa-2x"></i>
                            <?=$o_account->identity;?>
                        </a>
                    </td>

                    <td><?=$o_account->authority;?></td>
                    <td><?=$o_account->name?></td>
                    <td><?=$o_account->email?></td>
                    <td><?$o_account->is_female?></td>
                    <td><?=$o_account->phone?></td>
                    <td><?=$o_account->organization?></td>
                    <td><?=$date_insert->format("Y-m-d")?></td>
                </tr>
                <?php }?>

                <tr>
                    <td colspan="10">
                        <?php
                        $this->widget(
                            "PagingWidget",
                            array (
                                "totalItem"     => $i_totalItem,
                                "amountPerPage" => $i_amountPerPage,
                                "currentPage"   => $i_currentPage
                            )
                        );
                        ?>
                        <div class="clear"></div>
                    </td>
                </tr>
            </tbody>
        </table><!--End tb_general-->

        <div class="clear"></div>
    </div><!--End box_content-->
</div><!--End box-->


<div
    id    = "dialog_executing"
    title = "Chương trình đang thực thi"
    class = "dialog_message"
>
    <p class="center">
        <img alt="Loading...." src="<?=Yii::app()->baseUrl;?>/images/image_default/loading_circle.gif" width="92px" height="92px"/>
    </p>
</div> <!--End dialog_execute-->


<div
    id    = "dialog_notice"
    title = "Người Dùng"
    class = "dialog_message"
>
    <div id="content">
    </div>
</div><!--End dialog_notice-->


<script type="text/javascript">

$(document).ready(function () 
{
    //Init executing dialog with executing image
    $('#dialog_executing').dialog({
        autoOpen:      false,
        closeOnEscape: false,
        width:         220,
        height:        152,
        modal:         true,
        resizable:     false,
        show:          'explode',
        hide:          'explode',
        open:          function(event, ui) { $('.ui-dialog-titlebar-close').hide(); }
    });

    $("#dialog_notice").dialog({
        autoOpen:      false,
        closeOnEscape: true,
        width:         '72%',
        height:        'auto',
        modal:         true,
        show:          'explode',
        hide:          'explode'
    });
});//End document.ready


</script>